package chapter007.point01;

/**
 * 员工抽象类
 * 代码来源: https://www.runoob.com/java/java-abstraction.html
 *
 * @author Jack魏
 */
public abstract class Employee {
    private String name;
    private String address;
    private int number;

    public Employee(String name, String address, int number) {
        System.out.println("创建 Employee 对象");
        this.name = name;
        this.address = address;
        this.number = number;
    }

    public double computePay() {
        System.out.println("初始化 Employee computePay");
        return 0.0;
    }

    public void mailCheck() {
        System.out.println("发工资给 " + this.name
                + " " + this.address);
    }

    /**
     * 以字符串各式输出对象
     * 没有toString, 会输父类Object里面toString
     */
    public String toString() {
        return name + " " + address + " " + number;
    }

    public String getName() {
        return name;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String newAddress) {
        address = newAddress;
    }

    public int getNumber() {
        return number;
    }
}
